package com.mayikt;

import com.mayikt.service.UserService;
import com.mayikt.service.UserServiceServiceLocator;

public class HelloWorldClient {
  public static void main(String[] argv) {
      try {
          UserServiceServiceLocator locator = new UserServiceServiceLocator();
          UserService service = locator.getUserServicePort();
          // If authorization is required
          //((UserServicePortBindingStub)service).setUsername("user3");
          //((UserServicePortBindingStub)service).setPassword("pass3");
          // invoke business method
          //远程实现RPC调用，采用代理技术实现我们的结果
          String result= service.getUser(10l);
          System.out.println("result:"+result);
      } catch (javax.xml.rpc.ServiceException ex) {
          ex.printStackTrace();
      } catch (java.rmi.RemoteException ex) {
          ex.printStackTrace();
      }
  }
}
